package com.raindrop.rd.exception;

import com.raindrop.rd.parser.Span;

/**
 * @author BillDowney
 * @date 2021/3/23 16:48
 */
public class RDScriptException extends RuntimeException {

    private String simpleMessage;
    private Span location;

    public RDScriptException(String errorMessage, String simpleMessage, Span location) {
        super(errorMessage);
        this.simpleMessage = simpleMessage;
        this.location = location;
    }

    public RDScriptException(String errorMessage, Span location) {
        this(errorMessage, errorMessage, location);
    }

    public RDScriptException(String errorMessage) {
        this(errorMessage, errorMessage, null);
    }

    public RDScriptException(String message, String simpleMessage, Throwable cause, Span location) {
        super(message, cause);
        this.simpleMessage = simpleMessage;
        this.location = location;
    }

    public String getSimpleMessage() {
        return simpleMessage;
    }

    public Span getLocation() {
        return location;
    }
}
